import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/home'),
      children: [
        {
          path: '/recommend',
          component: () => import('@/views/recommend/recommend.vue'),
          children: [
            {
              path: '/',
              name: 'recommendHome',
              component: () => import('@/views/recommend/recommendHome.vue'),
              meta: {
                requiresAuth: true,
                label: '选款推荐'
              }
            },
            {
              path: 'recommendSubmit',
              name: 'recommendSubmit',
              meta: {
                requiresAuth: true,
                label: '已提交款'
              },
              component: () => import('@/views/recommend/childrenRoute/recommendSubmit.vue'),
            }
          ]
        },
        {
          path: '/recommendPassage',
          name: 'recommendPassage',
          meta: {
            requiresAuth: true,
            label: '在途款'
          },
          component: () => import('@/views/recommend/childrenRoute/recommendPassage.vue')
        },
        {
          path: '/commodityDetails',
          name: 'commodityDetails',
          meta: {
            requiresAuth: true,
            label: 'dynamic',//表示该字段是动态的
          },
          component: () => import('@/views/recommend/commodityDetails.vue'),
        },
        {
          path: '/walk',
          name: 'walk',
          meta: {
            requiresAuth: true,
            label: '逛一逛',
            scrollTop: 0
          },
          component: () => import('@/views/recommend/walk.vue')
        },
      ]
    }
  ]
})
